import React, { Component } from 'react';
import axios from 'axios'
import { SearchBar } from 'antd-mobile'

class search extends Component {
    constructor(props) {
        super(props);
        this.state = {
            search: "",
        }
    }
    handleInput() {

        console.log(this.state);

        axios.post("/api/search", this.state).then((res) => {
            console.log(res.data);
        })
    }
    render() {
        return (
            <div className="search">
                    <SearchBar className="inp" type="text" value={this.state.search} onInput={() => { this.handleInput() }} onChange={(e) => { this.setState({ search: e.target.value }) }} placeholder='搜索商品' />

                {/* <input placeholder="" /> */}
                {/* <input className="sear" onClick={() => { this.handleInput() }} type="button" value="搜索" /> */}
                <div className="as">
                    {this.props.children}
                </div>

            </div>
        );
    }

}

export default search;